local hx__jinshu = fk.CreateSkill {
  name = "hx__jinshu",
  tags = { Skill.Compulsory, },
}

hx__jinshu:addEffect(fk.TurnStart, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(hx__jinshu.name) then
      if event == fk.TurnStart then
        return player.shield < 2
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.TurnStart then
      if player.shield == 0 then
        room:changeShield(player, 2)
      elseif player.shield == 1 then
        room:changeShield(player,1)
      end
    end
  end,
})
hx__jinshu:addEffect(fk.HpChanged, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(hx__jinshu.name) then
      return target == player and player.shield == 0 and data.shield_lost ~= 0
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
      local tos = room:askToChoosePlayers(player, {
        targets = room:getAlivePlayers(),
        min_num = 1,
        max_num = 1,
        prompt = "请选择一名角色对其造成1火焰伤害",
        skill_name = hx__jinshu.name,
        cancelable = false,
      })
    local to = tos[1]
    room:damage{
      from = player,
      to = to,
      damage = 1,
      damageType = fk.FireDamage,
      skillName = hx__jinshu.name,
    }
  end,
})

return hx__jinshu